//
//  FeedBackVC.m
//  newProject
//
//  Created by 李航飞 on 2017/6/11.
//  Copyright © 2017年 李航飞. All rights reserved.
//

#import "FeedBackVC.h"
#import "FeedBackTableViewCell.h"
#import "AdviceViewController.h"
@interface FeedBackVC ()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic, strong)UITableView *tableView;

@end

@implementation FeedBackVC
- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    self.navigationController.navigationBarHidden=NO;
}
- (UITableView *)tableView{
    if (_tableView == nil) {
        _tableView = [[UITableView alloc] initWithFrame:self.view.frame style:UITableViewStyleGrouped];
        _tableView.delegate = self;
        _tableView.dataSource = self;
        _tableView.scrollEnabled = NO;
//        _tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
        _tableView.backgroundColor = RGB0X(0xf8f8f6);
        [_tableView registerClass:[FeedBackTableViewCell class] forCellReuseIdentifier:@"cell"];
       
        
    }
    return _tableView;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title=@"客服/反馈";
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:self.tableView];
    
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 2;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    if (section == 0) {
        return 1;
    }
    return 3;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    if(indexPath.row == 0){
        return 80*kScrenHidth;
    }
    return 71*kScrenHidth;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    FeedBackTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:SF(@"%ld",indexPath.row)];
    if (cell == nil) {
        cell = [[FeedBackTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:SF(@"%ld",indexPath.row)];
    }

    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    if (indexPath.section == 0) {
        cell.isBig = YES;
//        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
        cell.leftImageView.image = [UIImage imageNamed:@"在线客服"];
        cell.titleLable.text = @"在线客服";
        cell.detailLable.text = @"9 - 17 点实时回复";
    }else{
        [cell setSeparatorInset:UIEdgeInsetsZero];

        cell.isBig = NO;
        if (indexPath.row == 0) {
//            cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
            cell.titleLable.text = @"意见反馈";
            cell.detailLable.text = @"1-2个工作日内反馈";
            cell.leftImageView.image = [UIImage imageNamed:@"意见反馈"];
        }
        if (indexPath.row == 1) {
//            cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
            cell.titleLable.text = @"常见问题";
            cell.detailLable.text = @"配送时间、退款流程等";
            cell.leftImageView.image = [UIImage imageNamed:@"常见问题"];
        }
        if (indexPath.row == 2) {
            cell.titleLable.text = @"客服电话";
            cell.detailLable.text = @"024-2755-8986";
            cell.rightImageView.hidden = YES;
            cell.leftImageView.image = [UIImage imageNamed:@"客服电话"];
        }
    }
    
    
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    return 8*kScrenHidth;
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    if (section == 0) {
        return 8*kScrenHidth;
    }
    return 0.01;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.section == 1&&indexPath.row == 0) {
        AdviceViewController *vc = [[AdviceViewController alloc]init];
        [self.navigationController pushViewController:vc animated:YES];
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
